Generating Alter Script for Databases

Alter Script allows you to quickly generate alter script for a database after you make changes to a model. Although you can generate alter script using the Complete Compare wizard, the alter script generation option allows you to bypass the detailed compare features presented in the Complete Compare wizard.

This topic walks you through the steps to generate alter script with a Snowflake model as an example. Similarly, you can generate alter script from other databases. For more information on database specific forward engineering alter script generation options, refer to Forward Engineering Options for Databases topic.

To generate alter script for a database, follow these steps:

  1. Open a Snowflake model in erwin DM.

    Ensure that you are in the Physical mode.

  2. Go to Actions > Alter Script.
    The Forward Engineering Alter Script Schema Generation Wizard appears.
  3. Click Option Selection.
    The Option Selection tab displays the default option set. Clear the Drop check boxes and select other syntax check boxes as required. The available syntax check boxes differ based on your database. Select schema generation group to select schema generation options based on your requirements.
    Similarly, you can select schema generation syntax options for other databases.
  4. Click Next.
    The Summary section appears. It displays the selected options for schema generation.
  5. Review your option selection or edit the selection if required.
  6. Click Next.
    The Owner Override section appears. It displays objects for owner override.
  7. Enter an owner name to the Global Override object to override all assignments for the listed object groups. Or, enter an owner name for other object in this section to override assignments only to that object.

    The Global Override section is not available for all databases.

  8. Click Next.
    The Table Filter section appears. It displays a list of tables available in the model. Similarly, you can filter Collections or Records for other databases.
  9. Select the tables in the list that you want to forward engineer.
    Similarly, you can select Collections or Records for other databases based on your requirement.
  10. Click Preview to view the schema script.
  11. On the Preview section, use the following options:

    • Save (): Use this option to save the generated script in JSON or BSON format.

    • Print (): Use this option to search for a word or characters in the schema.

    • Search (): Use this option to search for a word or characters in the schema.

    • Copy (): Use this option to copy the script.

    • Replace (): Use this option to find and replace characters in the script.

    • Text Options (): Use this option to configure the preview text editor's look and feel, such as window, font, syntax color settings. For more information, refer to the Forward Engineering Wizard - Preview Editor topic.

  12. Click Generate.
    The forward engineering process starts. The script generates the physical database schema. You can view and verify the generated alter script for the database.

More information:

How you can generate an Alter Script in the Resolve Differences Dialog